<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="thx" uri="/thx-tags" %>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions"%>
	<div class="box-header with-border">
		<div class="row"></div>
	</div>
	<div class="box-body no-padding">
		<form id="appConfig-fieldOperate-form" name="ui-adminlte-form"
			data-toggle="validator" role="form" method="post" 
			action="${pageContext.request.contextPath}/workflow/authority!saveOperateAuth.action"
			forward-action="${pageContext.request.contextPath}/workflow/appConfig!list.action">
			<input name="appId" value="${appId }" type="hidden" />
			<table class="table table-bordered">
				<thead>
					<tr>
						<th>活动/字段</th>
						<c:forEach items="${listS}" var="menu">
							<th class="formPage ${menu}">  
								<input style="vertical-align: middle;" type="checkbox" name="select"/>
								${menu}
							</th>
						</c:forEach>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${listView}" var="view"  varStatus="viewIndex">
					<tr>
						<td>
							${view.name }
							<input type="hidden" name="dataView.name" value="${view.name }"/>
						</td>
						 <c:forEach items="${listS}" var="menu" varStatus="menuIndex">
							<td class="${menu}">
								 <c:forEach items="${view.check}" var="check" begin="${menuIndex.index}" end="${menuIndex.index}">
								 	<input name="dataView.check[${viewIndex.index}]" type="checkbox" value="${menuIndex.count }"<c:if test="${check==1 }">checked="checked"</c:if>/>
								</c:forEach>
							</td>
						</c:forEach>
					</tr>
					</c:forEach>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="${fun:length(listS)+1}">
							 <!--分页区-->
							<div class="pagePanel" style="margin-top:0px;">
							</div>
						</td>
					</tr>
				</tfoot>
			</table>
		    <div class="modal-footer">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</form>
	</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/horizontalPage4table.js"/>
<script src="${pageContext.request.contextPath}/workflow/js/app-form.js" ></script>
<script>
 $(function(){
	 $("#appConfig-fieldOperate-form table").pluginTablePage($("#appConfig-fieldOperate-form .formPage").length,7,".pagePanel");
	 
	appform.init("#appConfig-fieldOperate-form");
	
	var ifDinChecked = function(event){
		$("tr").each(function(i,n){
			$(n).find("td").eq($(event.target).parents("th").index()).find("input:checkbox").iCheck('check');
		});
	};
	var ifDinUnchecked = function(event){
		$("tr").each(function(i,n){
			$(n).find("td").eq($(event.target).parents("th").index()).find("input:checkbox").iCheck('uncheck');
		});
	};
	icheckPlugin.init($('#appConfig-fieldOperate-form input:not([name="select"])'));
	icheckPlugin.init($('#appConfig-fieldOperate-form input[name="select"]'),{ifChecked:ifDinChecked,ifUnchecked:ifDinUnchecked});
 })
</script>